class tuozhuai {
  constructor() {
      this.div = document.getElementsByTagName("div")[0];


  }
  show(){
      var div = this.div;
      div.onmousedown = function(ev){
        //  alert(11)
         var ev = ev||event;
          var disX = ev.offsetX;
          var disY = ev.offsetY;
         document.onmousemove = function(ev){
           var ev = ev||event;
            var x = ev.clientX-disX;
            var y = ev.clientY-disY;
           div.style.left = x+"px";
           div.style.top = y+"px";
         }
         document.onmouseup = function(){
           document.onmousemove = null;
         }
         return false;
      }

  }
}
let str = new tuozhuai();
str.show();
